<template>
  <div class="home">
    <div class="user">
      <div class="user-left">
        <div>
          <img style="width:100px;height:100px;border-radius:50%" :src="userInfo.icon" alt="">
          <p>{{ userInfo.username }}</p>
          <p><el-icon />交互专家</p>
          <p><el-icon /> 不凡学院－某某某事业群－某某平台部－某某技术部－UED </p>
          <p><el-icon /> 河南省 郑州市 金水区 绿地新都会 </p>
        </div>
        <div>
          <p>标签</p>
          <div v-for="(item,index) in label" :key="index">
            <span>{{ item }}</span>
            <span @click="delLabel(index)">x</span>
          </div>
          <span @click="addLabel">+</span>
          <input v-if="isShow" v-model="labelText" type="text" @change="inputEvent">
        </div>
        <div>
          <div v-for="(item,index) in title" :key="index">
            <span>{{ item.name }}</span>
          </div>
        </div>
      </div>
      <div class="user-right">
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="文章" name="first">
            <div v-for="item in articleList" :key="item">
              <p>{{ item.name }}</p>
              <div>
                <div v-for="itm in item.title" :key="itm">
                  {{ itm }}
                </div>
              </div>
              <p>{{ item.text }}</p>
              <p>{{ item.user }}{{ item.time }}</p>
              <p>{{ item.num1 }}{{ item.num2 }}{{ item.num3 }}</p>
            </div>

          </el-tab-pane>
          <el-tab-pane label="项目" name="second">
            <div v-for="item in projectList" :key="item">
              <img src="" alt="">
              <p>{{ item.title }}</p>
              <p>{{ item.text }}</p>
              <p><span>{{ item.time }}</span></p>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
</template>

<script>
import { getUserInfo } from '@/utils/myAuth'
export default {
  name: 'VueAdminTemplateMasterIndex',

  data() {
    return {
      activeName: 'first',
      userInfo: {},
      label: ['不凡人', '学霸', '专业学习', '高颜值', '随便', '无所谓'],
      isShow: false,
      labelText: '',
      title: [{ icon: '', name: '不凡UI设计组' }, { icon: '', name: '不凡前端开发组' }, { icon: '', name: '阿里支付组' },
        { icon: '', name: 'vue小组' }, { icon: '', name: '全员都是吴彦组' }, { icon: '', name: '高逼格天团' }],
      articleList: [],
      info: {
        name: 'Vue',
        title: ['Element', '饿了么', '设计语言'],
        text: '段落示意：element，用最小的工作量，无缝接入蚂蚁金服生态，提供跨越设计与开发的体验解决方案。element，用最小的工作量，无缝接入蚂蚁金服生态，提供跨越设计与开发的体验解决方案。',
        num1: 125,
        num2: 13453,
        num3: 222,
        user: '周树人',
        time: '2020-11-20 10:33'
      },
      projectList: [],
      projectInfo: {
        pic: '',
        title: '不凡学院',
        text: ' 那是一种内在的东西， 他们到达不了，也无法触及的 ',
        time: '1天前',
        img: ['', '', '']
      }
    }
  },

  created() {
    this.userInfo = getUserInfo()
    console.log(this.userInfo)
    for (var i = 0; i < 8; i++) {
      this.articleList.push(this.info)
    }
    for (var t = 0; t < 8; t++) {
      this.projectList.push(this.projectInfo)
    }
  },

  mounted() {},

  methods: {
    delLabel(index) {
      this.label.splice(index, 1)
    },
    inputEvent() {
      this.label.push(this.labelText)
      this.labelText = ''
      this.isShow = false
    },
    addLabel() {
      this.isShow = true
    }
  }
}
</script>

<style scoped lang="scss">
.home {
  background-color: #f0f2f5;
  overflow: hidden;
  .user {
    background-color: #fff;
    margin: 30px;
    padding: 10px;
    width: 95%;
    height: 800px;
    display: flex;
    .user-left,
    .user-right {
      height: 500px;
      border: 1px solid #ebeef5;
      margin: 10px;
      padding: 10px;
    }
    .user-left {
      width: 40%;
    }
    .user-right {
      width: 60%;
    }
  }
}
</style>
